package com.sudo.api._admin;

import com.sudo.common.annotation.ApiIdempotent;
import com.sudo.service.admin.mail.MailPojo;
import com.sudo.service.admin.mail.MailService;
import com.sudo.common.utils.JsonRes;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Slf4j
@Api(value = "邮件服务",tags = {"邮件发送相关接口"})
@RestController
@RequestMapping("mailRun")
public class MailController {
    @Resource
    private MailService mailService;

    @ApiIdempotent
    @GetMapping("/sendSimpleMail")
    public JsonRes queryMySysMenu(HttpServletRequest request) {
        MailPojo mailPojo = new MailPojo();
        mailPojo.setTitle("假的");
        String[] mails = {"fengwei@aograph.com"};
        mailPojo.setSentTo(mails);
        mailPojo.setText("我不知道");
        mailService.sendSimpleMail(mailPojo);

        return JsonRes.ok();
    }
}
